package com.aiyige.page.publish.info.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.aiyige.page.publish.info.adapter.PublishInfoAdapter;
import com.aiyige.page.publish.util.PublishUtil;
import com.chad.library.adapter.base.entity.MultiItemEntity;

import java.io.Serializable;

/**
 * Created by zhuyakun on 2017/11/10.
 */

public class VideoNode implements MultiItemEntity {
    String videoUrl;
    String coverUrl;
    long duration;
    long size;
    int nodeType = PublishInfoAdapter.NODE_TYPE_VIDEO;

    public VideoNode() {
    }

    private VideoNode(Builder builder) {
        setVideoUrl(builder.videoUrl);
        setCoverUrl(builder.coverUrl);
        setDuration(builder.duration);
        setSize(builder.size);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public String getVideoUrl() {
        return videoUrl;
    }

    public void setVideoUrl(String videoUrl) {
        this.videoUrl = videoUrl;
    }

    public String getCoverUrl() {
        return coverUrl;
    }

    public void setCoverUrl(String coverUrl) {
        this.coverUrl = coverUrl;
    }

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public int getNodeType() {
        return nodeType;
    }

    public void setNodeType(int nodeType) {
        this.nodeType = nodeType;
    }

    @Override
    public int getItemType() {
        return nodeType;
    }


    public static final class Builder {
        private String videoUrl;
        private String coverUrl;
        private long duration;
        private long size;

        private Builder() {
            videoUrl = "";
            coverUrl = "";
            duration = 0;
            size = 0;
        }

        public Builder videoUrl(String videoUrl) {
            this.videoUrl = videoUrl;
            return this;
        }

        public Builder coverUrl(String coverUrl) {
            this.coverUrl = coverUrl;
            return this;
        }

        public Builder duration(long duration) {
            this.duration = duration;
            return this;
        }

        public Builder size(long size) {
            this.size = size;
            return this;
        }

        public VideoNode build() {
            return new VideoNode(this);
        }
    }
}
